package com.sjzl.entity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name="tb_user")
public class User extends BaseEntity {
	/**
	 * 账户名
	 */
	private String account;
	/**
	 * 密码
	 */
	private String password;
	/**
	 * 头像路径
	 */
	private String headImageSrc;
	/**
	 * 邮箱
	 */
	private String email;
	/**
	 * 姓名
	 */
	private String name;
	/**
	 * 性别
	 */
	private String sex;
	/**
	 * 所属国家
	 */
	private String country;
	/**
	 * 所属省份
	 */
	private String province;
	/**
	 * 所属城市
	 */
	private String city;
	/**
	 * 职业
	 */
	private String vocation;
	/**
	 * 所属行业
	 */
	private String industry;
	/**
	 * 自我介绍
	 */
	private String introduction;
	/**
	 * 创建时IP
	 */
	private String ipCreated;
	/**
	 * 最后一次活动结束时时间
	 */
	private Date dateLastActived;
	
	/**
	 * 所管理版块
	 */
	private List<Board> boards = new ArrayList<Board>();
	/**
	 * 用户等级
	 */
	private Integer level;
	/**
	 * 会员积分
	 */
	private Integer integral;
	/**
	 * 所创帖子
	 */
	private List<Post> posts = new ArrayList<Post>();
	/**
	 * 所创帖子总数
	 */
	private Integer postCount;
	/**
	 * 好友
	 */
	private List<Friend> friends = new ArrayList<Friend>();
	/**
	 * 留言
	 */
	private List<Notification> notifications = new ArrayList<Notification>();
	/**
	 * 心情
	 */
	private String mood;
	
	public String getAccount() {
		return account;
	}
	public void setAccount(String account) {
		this.account = account;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getHeadImageSrc() {
		return headImageSrc;
	}
	public void setHeadImageSrc(String headImageSrc) {
		this.headImageSrc = headImageSrc;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getVocation() {
		return vocation;
	}
	public void setVocation(String vocation) {
		this.vocation = vocation;
	}
	public String getIndustry() {
		return industry;
	}
	public void setIndustry(String industry) {
		this.industry = industry;
	}
	public String getIntroduction() {
		return introduction;
	}
	public void setIntroduction(String introduction) {
		this.introduction = introduction;
	}
	public String getIpCreated() {
		return ipCreated;
	}
	public void setIpCreated(String ipCreated) {
		this.ipCreated = ipCreated;
	}
	@Temporal(value = TemporalType.TIMESTAMP)
	public Date getDateLastActived() {
		return dateLastActived;
	}
	public void setDateLastActived(Date dateLastActived) {
		this.dateLastActived = dateLastActived;
	}
	
	@ManyToMany(mappedBy = "moderators", cascade = CascadeType.REMOVE)
	public List<Board> getBoards() {
		return boards;
	}
	public void setBoards(List<Board> boards) {
		this.boards = boards;
	}
	public Integer getLevel() {
		return level;
	}
	public void setLevel(Integer level) {
		this.level = level;
	}
	public Integer getIntegral() {
		return integral;
	}
	public void setIntegral(Integer integral) {
		this.integral = integral;
	}
	
	@OneToMany(mappedBy = "user", cascade = {CascadeType.REMOVE})
	public List<Post> getPosts() {
		return posts;
	}
	public void setPosts(List<Post> posts) {
		this.posts = posts;
	}
	
	public Integer getPostCount() {
		return postCount;
	}
	public void setPostCount(Integer postCount) {
		this.postCount = postCount;
	}
	
	@OneToMany(mappedBy = "user", cascade = CascadeType.REMOVE)
	public List<Friend> getFriends() {
		return friends;
	}
	public void setFriends(List<Friend> friends) {
		this.friends = friends;
	}
	
	@OneToMany(mappedBy = "user", cascade = CascadeType.REMOVE)
	public List<Notification> getNotifications() {
		return notifications;
	}
	public void setNotifications(List<Notification> notifications) {
		this.notifications = notifications;
	}
	public String getCountry() {
		return country;
	}
	public void setCountry(String country) {
		this.country = country;
	}
	public String getProvince() {
		return province;
	}
	public void setProvince(String province) {
		this.province = province;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public String getMood() {
		return mood;
	}
	public void setMood(String mood) {
		this.mood = mood;
	}
	
}
